package com.fw.ui.view.settings.usercontrol.parentmerchant;

import static org.springframework.beans.factory.config.BeanDefinition.SCOPE_PROTOTYPE;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;

import com.fw.service.bean.EntryBean;
import com.fw.service.bean.SearchCriteriaBean;
import com.fw.service.bean.SearchResultBean;
import com.fw.service.formvalidator.FormValidatorService;
import com.fw.service.merchantprofile.bean.MerchantProfileBean;
import com.fw.service.merchantprofile.bean.SearchMerchantProfileBean;
import com.fw.service.parentmerchant.bean.ParentMerchantBean;
import com.fw.ui.bao.MasterDataBAO;
import com.fw.ui.bao.MerchantProfileBAO;
import com.fw.ui.bao.MessageBAO;
import com.fw.ui.bao.ParentMerchantBAO;
import com.fw.ui.bao.PropertyBAO;
import com.fw.ui.bean.parentmerchant.SearchMerchantProfileTableItemBean;
import com.fw.ui.core.ViewDescription;
import com.fw.ui.util.UICommonUtils;
import com.fw.ui.util.VaadinApplicationObjectSupport;
import com.fw.ui.util.validator.StringLengthValidator;
import com.fw.ui.view.AbstractView;
import com.fw.ui.view.common.TablePanel;
import com.fw.ui.view.common.util.TableHeaderProperty;
import com.fw.ui.view.settings.usercontrol.parentmerchant.event.EditParentMerchantCancelButtonClickListener;
import com.fw.ui.view.settings.usercontrol.parentmerchant.event.EditParentMerchantSaveButtonClickListener;
import com.fw.ui.view.settings.usercontrol.parentmerchant.event.EditParentMerchantSearchMerchantProfileClearButtonClickListener;
import com.fw.ui.view.settings.usercontrol.parentmerchant.event.EditParentMerchantSearchMerchantProfileSearchButtonClickListener;
import com.fw.ui.view.settings.usercontrol.parentmerchant.event.EditParentMerchantSearchMerchantProfileTableAddButtonClickListener;
import com.fw.ui.view.settings.usercontrol.parentmerchant.event.EditParentMerchantSearchMerchantProfileTablePageButtonClickListener;
import com.fw.ui.view.settings.usercontrol.parentmerchant.event.EditParentMerchantSearchMerchantProfileTableSizeValueChangeListener;
import com.fw.ui.view.settings.usercontrol.parentmerchant.event.EditParentMerchantSelectedMerchantProfileTablePageButtonClickListener;
import com.fw.ui.view.settings.usercontrol.parentmerchant.event.EditParentMerchantSelectedMerchantProfileTableRemoveButtonClickListener;
import com.fw.ui.view.settings.usercontrol.parentmerchant.event.EditParentMerchantSelectedMerchantProfileTableSizeValueChangeListener;
import com.vaadin.data.util.BeanItem;
import com.vaadin.data.validator.RegexpValidator;
import com.vaadin.server.Page;
import com.vaadin.server.VaadinService;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Notification;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Table.Align;
import com.vaadin.ui.TextArea;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;

@org.springframework.stereotype.Component
@Scope(SCOPE_PROTOTYPE)
@ViewDescription(name = "settings-user-control-parentmerchant-edit", path = "/settings/user-control/parentmerchant-edit")
public class EditParentMerchantView extends AbstractView {

    public static final String EDIT_PARENT_MERCHANT_ID_REQUEST_ATTRIBUTE = "EDIT_PARENT_MERCHANT_ID_REQUEST_ATTRIBUTE";

    private static final long serialVersionUID = 1L;

    @Autowired
    protected transient VaadinApplicationObjectSupport app;

    @Autowired
    private MasterDataBAO masterDataBAO;
    @Autowired
    private PropertyBAO propertyBAO;
    @Autowired
    private MessageBAO messageBAO;
    @Autowired
    private MerchantProfileBAO merchantProfileBAO;
    @Autowired
    private ParentMerchantBAO parentMerchantBAO;

    private Map<String, String> merchantStatusMap = new HashMap<String, String>();
    @SuppressWarnings("rawtypes")
    private Map<Long, BeanItem> selectedBeanItemMap = new LinkedHashMap<Long, BeanItem>();

    /**
     * BEAN
     */
    private ParentMerchantBean parentMerchantBean = new ParentMerchantBean();
    private SearchCriteriaBean<SearchMerchantProfileBean> searchCriteriaBean = new SearchCriteriaBean<SearchMerchantProfileBean>();

    /**
     * EVENT
     */
    @Autowired
    private EditParentMerchantSearchMerchantProfileSearchButtonClickListener editParentMerchantSearchMerchantProfileSearchButtonClickListener;
    @Autowired
    private EditParentMerchantSearchMerchantProfileClearButtonClickListener editParentMerchantSearchMerchantProfileClearButtonClickListener;

    @Autowired
    private EditParentMerchantSearchMerchantProfileTableAddButtonClickListener editParentMerchantSearchMerchantProfileTableAddButtonClickListener;
    @Autowired
    private EditParentMerchantSelectedMerchantProfileTableRemoveButtonClickListener editParentMerchantSelectedMerchantProfileTableRemoveButtonClickListener;

    @Autowired
    private EditParentMerchantSearchMerchantProfileTablePageButtonClickListener editParentMerchantSearchMerchantProfileTablePageButtonClickListener;
    @Autowired
    private EditParentMerchantSearchMerchantProfileTableSizeValueChangeListener editParentMerchantSearchMerchantProfileTableSizeValueChangeListener;

    @Autowired
    private EditParentMerchantSelectedMerchantProfileTablePageButtonClickListener editParentMerchantSelectedMerchantProfileTablePageButtonClickListener;
    @Autowired
    private EditParentMerchantSelectedMerchantProfileTableSizeValueChangeListener editParentMerchantSelectedMerchantProfileTableSizeValueChangeListener;

    @Autowired
    private EditParentMerchantSaveButtonClickListener editParentMerchantSaveButtonClickListener;
    @Autowired
    private EditParentMerchantCancelButtonClickListener editParentMerchantCancelButtonClickListener;

    /**
     * COMPONENT
     */
    private Panel editParentMerchantPanel = new Panel();

    private Panel editParentMerchantProfilePanel = new Panel();
    private Panel editParentMerchantContactPersonPanel = new Panel();
    private Panel editMerchantMemberPanel = new Panel();

    private GridLayout gridParentMerchantPanelLayout = new GridLayout(4, 3);
    private GridLayout gridParentMerchantProfileLayout = new GridLayout(4, 4);
    private GridLayout gridParentMerchantContactPersonLayout = new GridLayout(4, 5);
    private GridLayout gridParentMerchantMemberLayout = new GridLayout(1, 3);
    private GridLayout gridParentMerchantSearchLayout = new GridLayout(8, 5);

    private Label lblParentMerchantID = new Label();
    private Label lblParentMerchantName = new Label();
    private Label lblBusinessAddress = new Label();
    private Label lblParentStatus = new Label();
    private Label lblTitle = new Label();
    private Label lblFirstName = new Label();
    private Label lblLastName = new Label();
    private Label lblTelephoneNumber = new Label();
    private Label lblEmailAddress = new Label();

    private TextField txtParentMerchantID = new TextField();
    private TextField txtParentMerchantName = new TextField();
    private TextArea txtBusinessAddress = new TextArea();
    private ComboBox cbbParentStatus = new ComboBox();
    private ComboBox cbbTitle = new ComboBox();
    private TextField txtFirstName = new TextField();
    private TextField txtLastName = new TextField();
    private TextField txtTelephoneNumber = new TextField();
    private TextField txtEmailAddress = new TextField();

    private Label lblParentMerchantIDValidateMessage = new Label("", ContentMode.HTML);
    private Label lblParentMerchantNameValidateMessage = new Label("", ContentMode.HTML);
    private Label lblBusinessAddressValidateMessage = new Label("", ContentMode.HTML);
    private Label lblParentStatusValidateMessage = new Label("", ContentMode.HTML);
    private Label lblTitleValidateMessage = new Label("", ContentMode.HTML);
    private Label lblFirstNameValidateMessage = new Label("", ContentMode.HTML);
    private Label lblLastNameValidateMessage = new Label("", ContentMode.HTML);
    private Label lblTelephoneNumberValidateMessage = new Label("", ContentMode.HTML);
    private Label lblEmailAddressValidateMessage = new Label("", ContentMode.HTML);

    private Label lblMerchantID = new Label();
    private Label lblMerchantCompanyName = new Label();
    private Label lblMerchantUrl = new Label();
    private Label lblMerchantContactPerson = new Label();
    private Label lblMerchantStatus = new Label();

    private TextField txtMerchantID = new TextField();
    private TextField txtMerchantCompanyName = new TextField();
    private TextField txtMerchantUrl = new TextField();
    private TextField txtMerchantContactPerson = new TextField();
    private ComboBox cbbMerchantStatus = new ComboBox();

    private Button btnMerchantSearch = new Button();
    private Button btnMerchantClear = new Button();

    @Autowired
    protected TablePanel tableMerchantPanel;
    private TableHeaderProperty hCommand = new TableHeaderProperty();
    private TableHeaderProperty hNo = new TableHeaderProperty();
    private TableHeaderProperty hMerchantID = new TableHeaderProperty();
    private TableHeaderProperty hMerchantCompanyName = new TableHeaderProperty();
    private TableHeaderProperty hMerchantUrl = new TableHeaderProperty();
    private TableHeaderProperty hMerchantContactPerson = new TableHeaderProperty();
    private TableHeaderProperty hMerchantStatus = new TableHeaderProperty();
    private TableHeaderProperty hId = new TableHeaderProperty();

    @Autowired
    protected TablePanel tableMerchantSelectedPanel;
    private TableHeaderProperty hCommandSelected = new TableHeaderProperty();
    private TableHeaderProperty hNoSelected = new TableHeaderProperty();
    private TableHeaderProperty hMerchantIDSelected = new TableHeaderProperty();
    private TableHeaderProperty hMerchantCompanyNameSelected = new TableHeaderProperty();
    private TableHeaderProperty hMerchantUrlSelected = new TableHeaderProperty();
    private TableHeaderProperty hMerchantContactPersonSelected = new TableHeaderProperty();
    private TableHeaderProperty hMerchantStatusSelected = new TableHeaderProperty();
    private TableHeaderProperty hIdSelected = new TableHeaderProperty();

    private Button btnSave = new Button();
    private Button btnCancel = new Button();

    private List<Button> tableAddButtons = new ArrayList<Button>();
    private List<Button> tableRemoveButtons = new ArrayList<Button>();

    @Autowired
    private UICommonUtils uiCommonUtils;

    @Override
    public void updateStrings() {

	this.editParentMerchantPanel.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.panel.editParentMerchantPanel"));
	this.editParentMerchantProfilePanel
		.setCaption(this.messageBAO
			.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.panel.editParentMerchantProfilePanel"));
	this.editParentMerchantContactPersonPanel
		.setCaption(this.messageBAO
			.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.panel.editParentMerchantContactPersonPanel"));
	this.editMerchantMemberPanel.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.panel.editMerchantMemberPanel"));
	this.tableMerchantPanel.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.panel.searchMerchantMember"));
	this.tableMerchantSelectedPanel.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.panel.parentMerchantMember"));

	this.lblParentMerchantID.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.label.parentMerchantID"));
	this.lblParentMerchantName.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.label.parentMerchantName"));
	this.lblBusinessAddress.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.label.businessAddress"));
	this.lblParentStatus.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.label.parentStatus"));
	this.lblTitle.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.label.title"));
	this.lblFirstName.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.label.firstName"));
	this.lblLastName.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.label.lastName"));
	this.lblTelephoneNumber.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.label.telephoneNumber"));
	this.lblEmailAddress.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.label.emailAddress"));

	this.lblMerchantID.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.label.merchantID"));
	this.lblMerchantCompanyName.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.label.merchantCompanyName"));
	this.lblMerchantUrl.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.label.merchantUrl"));
	this.lblMerchantContactPerson.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.label.merchantContactPerson"));
	this.lblMerchantStatus.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.label.merchantStatus"));

	this.btnMerchantSearch.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.button.merchantSearch"));
	this.btnMerchantClear.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.button.merchantClear"));

	this.hCommand.setColumnName(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.header.command"));
	this.hNo.setColumnName(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.header.no"));
	this.hMerchantID.setColumnName(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.header.merchantID"));
	this.hMerchantCompanyName.setColumnName(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.header.merchantCompnayName"));
	this.hMerchantUrl.setColumnName(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.header.merchantUrl"));
	this.hMerchantContactPerson.setColumnName(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.header.merchantContactPerson"));
	this.hMerchantStatus.setColumnName(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.header.merchantStatus"));

	tableMerchantPanel.setTableColumnHeader(this.hCommand.getColumnId(), this.hCommand.getColumnName());
	tableMerchantPanel.setTableColumnHeader(this.hNo.getColumnId(), this.hNo.getColumnName());
	tableMerchantPanel.setTableColumnHeader(this.hMerchantID.getColumnId(), this.hMerchantID.getColumnName());
	tableMerchantPanel.setTableColumnHeader(this.hMerchantCompanyName.getColumnId(), this.hMerchantCompanyName.getColumnName());
	tableMerchantPanel.setTableColumnHeader(this.hMerchantUrl.getColumnId(), this.hMerchantUrl.getColumnName());
	tableMerchantPanel.setTableColumnHeader(this.hMerchantContactPerson.getColumnId(), this.hMerchantContactPerson.getColumnName());
	tableMerchantPanel.setTableColumnHeader(this.hMerchantStatus.getColumnId(), this.hMerchantStatus.getColumnName());

	this.hCommandSelected.setColumnName(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.header.command"));
	this.hNoSelected.setColumnName(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.header.no"));
	this.hMerchantIDSelected.setColumnName(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.header.merchantID"));
	this.hMerchantCompanyNameSelected.setColumnName(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.header.merchantCompnayName"));
	this.hMerchantUrlSelected.setColumnName(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.header.merchantUrl"));
	this.hMerchantContactPersonSelected.setColumnName(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.header.merchantContactPerson"));
	this.hMerchantStatusSelected.setColumnName(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.header.merchantStatus"));

	tableMerchantSelectedPanel.setTableColumnHeader(this.hCommandSelected.getColumnId(), this.hCommandSelected.getColumnName());
	tableMerchantSelectedPanel.setTableColumnHeader(this.hNoSelected.getColumnId(), this.hNoSelected.getColumnName());
	tableMerchantSelectedPanel.setTableColumnHeader(this.hMerchantIDSelected.getColumnId(), this.hMerchantIDSelected.getColumnName());
	tableMerchantSelectedPanel.setTableColumnHeader(this.hMerchantCompanyNameSelected.getColumnId(),
		this.hMerchantCompanyNameSelected.getColumnName());
	tableMerchantSelectedPanel.setTableColumnHeader(this.hMerchantUrlSelected.getColumnId(), this.hMerchantUrlSelected.getColumnName());
	tableMerchantSelectedPanel.setTableColumnHeader(this.hMerchantContactPersonSelected.getColumnId(),
		this.hMerchantContactPersonSelected.getColumnName());
	tableMerchantSelectedPanel.setTableColumnHeader(this.hMerchantStatusSelected.getColumnId(),
		this.hMerchantStatusSelected.getColumnName());

	this.btnSave.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.button.save"));
	this.btnCancel.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.button.cancel"));
    }

    @Override
    public void init() {
	setSizeFull();

	editParentMerchantPanel.setSizeFull();
	editParentMerchantPanel.setId("editParentMerchantPanel");

	editParentMerchantProfilePanel.setSizeFull();
	editParentMerchantProfilePanel.setId("editParentMerchantProfilePanel");

	editParentMerchantContactPersonPanel.setSizeFull();
	editParentMerchantContactPersonPanel.setId("editParentMerchantContactPersonPanel");

	editMerchantMemberPanel.setSizeFull();
	editMerchantMemberPanel.setId("editMerchantMemberPanel");

	lblParentMerchantIDValidateMessage.addStyleName("validate-error");
	lblParentMerchantNameValidateMessage.addStyleName("validate-error");
	lblBusinessAddressValidateMessage.addStyleName("validate-error");
	lblParentStatusValidateMessage.addStyleName("validate-error");
	lblTitleValidateMessage.addStyleName("validate-error");
	lblFirstNameValidateMessage.addStyleName("validate-error");
	lblLastNameValidateMessage.addStyleName("validate-error");
	lblTelephoneNumberValidateMessage.addStyleName("validate-error");
	lblEmailAddressValidateMessage.addStyleName("validate-error");

	lblParentMerchantIDValidateMessage.setVisible(false);
	lblParentMerchantNameValidateMessage.setVisible(false);
	lblBusinessAddressValidateMessage.setVisible(false);
	lblParentStatusValidateMessage.setVisible(false);
	lblTitleValidateMessage.setVisible(false);
	lblFirstNameValidateMessage.setVisible(false);
	lblLastNameValidateMessage.setVisible(false);
	lblTelephoneNumberValidateMessage.setVisible(false);
	lblEmailAddressValidateMessage.setVisible(false);

	lblParentMerchantIDValidateMessage.setId("lblParentMerchantIDValidateMessage" + UICommonUtils.INCLUDE_VALUE_COMPONENT_PREFIX);
	lblParentMerchantNameValidateMessage.setId("lblParentMerchantNameValidateMessage" + UICommonUtils.INCLUDE_VALUE_COMPONENT_PREFIX);
	lblBusinessAddressValidateMessage.setId("lblBusinessAddressValidateMessage" + UICommonUtils.INCLUDE_VALUE_COMPONENT_PREFIX);
	lblParentStatusValidateMessage.setId("lblParentStatusValidateMessage" + UICommonUtils.INCLUDE_VALUE_COMPONENT_PREFIX);
	lblTitleValidateMessage.setId("lblTitleValidateMessage" + UICommonUtils.INCLUDE_VALUE_COMPONENT_PREFIX);
	lblFirstNameValidateMessage.setId("lblFirstNameValidateMessage" + UICommonUtils.INCLUDE_VALUE_COMPONENT_PREFIX);
	lblLastNameValidateMessage.setId("lblLastNameValidateMessage" + UICommonUtils.INCLUDE_VALUE_COMPONENT_PREFIX);
	lblTelephoneNumberValidateMessage.setId("lblTelephoneNumberValidateMessage" + UICommonUtils.INCLUDE_VALUE_COMPONENT_PREFIX);
	lblEmailAddressValidateMessage.setId("lblEmailAddressValidateMessage" + UICommonUtils.INCLUDE_VALUE_COMPONENT_PREFIX);

	String labelWidth = "150px";
	lblParentMerchantID.setWidth(labelWidth);
	lblParentMerchantName.setWidth(labelWidth);
	lblBusinessAddress.setWidth(labelWidth);
	lblParentStatus.setWidth(labelWidth);
	lblTitle.setWidth(labelWidth);
	lblFirstName.setWidth(labelWidth);
	lblLastName.setWidth(labelWidth);
	lblTelephoneNumber.setWidth(labelWidth);
	lblEmailAddress.setWidth(labelWidth);

	lblMerchantID.setWidth(labelWidth);
	lblMerchantCompanyName.setWidth(labelWidth);
	lblMerchantUrl.setWidth(labelWidth);
	lblMerchantContactPerson.setWidth(labelWidth);
	lblMerchantStatus.setWidth(labelWidth);

	String inputWidth = "200px";
	txtParentMerchantID.setWidth(inputWidth);
	txtParentMerchantName.setWidth(inputWidth);
	txtBusinessAddress.setWidth(inputWidth);
	cbbParentStatus.setWidth(inputWidth);
	cbbTitle.setWidth(inputWidth);
	txtFirstName.setWidth(inputWidth);
	txtLastName.setWidth(inputWidth);
	txtTelephoneNumber.setWidth(inputWidth);
	txtEmailAddress.setWidth(inputWidth);

	txtMerchantID.setWidth(inputWidth);
	txtMerchantCompanyName.setWidth(inputWidth);
	txtMerchantUrl.setWidth(inputWidth);
	txtMerchantContactPerson.setWidth(inputWidth);
	cbbMerchantStatus.setWidth(inputWidth);

	editParentMerchantPanel.setContent(gridParentMerchantPanelLayout);
	gridParentMerchantPanelLayout.setSizeFull();
	gridParentMerchantPanelLayout.setColumnExpandRatio(0, 5);
	gridParentMerchantPanelLayout.setColumnExpandRatio(1, 45);
	gridParentMerchantPanelLayout.setColumnExpandRatio(2, 45);
	gridParentMerchantPanelLayout.setColumnExpandRatio(3, 5);
	gridParentMerchantPanelLayout.addComponent(editParentMerchantProfilePanel, 1, 0);
	gridParentMerchantPanelLayout.setComponentAlignment(editParentMerchantProfilePanel, Alignment.TOP_LEFT);
	gridParentMerchantPanelLayout.addComponent(editParentMerchantContactPersonPanel, 2, 0);
	gridParentMerchantPanelLayout.setComponentAlignment(editParentMerchantContactPersonPanel, Alignment.TOP_LEFT);
	gridParentMerchantPanelLayout.addComponent(editMerchantMemberPanel, 0, 1, 3, 1);
	gridParentMerchantPanelLayout.setComponentAlignment(editMerchantMemberPanel, Alignment.TOP_CENTER);

	editParentMerchantProfilePanel.setContent(gridParentMerchantProfileLayout);
	gridParentMerchantProfileLayout.setSizeFull();
	gridParentMerchantProfileLayout.setSpacing(true);
	gridParentMerchantProfileLayout.setMargin(true);
	gridParentMerchantProfileLayout.setColumnExpandRatio(0, 10);
	gridParentMerchantProfileLayout.setColumnExpandRatio(1, 20);
	gridParentMerchantProfileLayout.setColumnExpandRatio(2, 60);
	gridParentMerchantProfileLayout.setColumnExpandRatio(3, 10);
	gridParentMerchantProfileLayout.setRowExpandRatio(0, 2);
	gridParentMerchantProfileLayout.setRowExpandRatio(1, 1);
	gridParentMerchantProfileLayout.setRowExpandRatio(2, 1);
	gridParentMerchantProfileLayout.setRowExpandRatio(3, 2);
	gridParentMerchantProfileLayout.addComponent(lblParentMerchantID, 1, 0);
	gridParentMerchantProfileLayout.setComponentAlignment(lblParentMerchantID, Alignment.TOP_LEFT);
	VerticalLayout parentMerchantIdLayout = new VerticalLayout();
	parentMerchantIdLayout.addComponent(txtParentMerchantID);
	parentMerchantIdLayout.addComponent(lblParentMerchantIDValidateMessage);
	gridParentMerchantProfileLayout.addComponent(parentMerchantIdLayout, 2, 0);
	gridParentMerchantProfileLayout.setComponentAlignment(parentMerchantIdLayout, Alignment.TOP_LEFT);
	gridParentMerchantProfileLayout.addComponent(lblParentMerchantName, 1, 1);
	gridParentMerchantProfileLayout.setComponentAlignment(lblParentMerchantName, Alignment.TOP_LEFT);
	VerticalLayout parentMerchantNameLayout = new VerticalLayout();
	parentMerchantNameLayout.addComponent(txtParentMerchantName);
	parentMerchantNameLayout.addComponent(lblParentMerchantNameValidateMessage);
	gridParentMerchantProfileLayout.addComponent(parentMerchantNameLayout, 2, 1);
	gridParentMerchantProfileLayout.setComponentAlignment(parentMerchantNameLayout, Alignment.TOP_LEFT);
	gridParentMerchantProfileLayout.addComponent(lblBusinessAddress, 1, 2);
	gridParentMerchantProfileLayout.setComponentAlignment(lblBusinessAddress, Alignment.TOP_LEFT);
	VerticalLayout businessAddressLayout = new VerticalLayout();
	businessAddressLayout.addComponent(txtBusinessAddress);
	businessAddressLayout.addComponent(lblBusinessAddressValidateMessage);
	gridParentMerchantProfileLayout.addComponent(businessAddressLayout, 2, 2);
	gridParentMerchantProfileLayout.setComponentAlignment(businessAddressLayout, Alignment.TOP_LEFT);
	gridParentMerchantProfileLayout.addComponent(lblParentStatus, 1, 3);
	gridParentMerchantProfileLayout.setComponentAlignment(lblParentStatus, Alignment.TOP_LEFT);
	VerticalLayout parentStatusLayout = new VerticalLayout();
	parentStatusLayout.addComponent(cbbParentStatus);
	parentStatusLayout.addComponent(lblParentStatusValidateMessage);
	gridParentMerchantProfileLayout.addComponent(parentStatusLayout, 2, 3);
	gridParentMerchantProfileLayout.setComponentAlignment(parentStatusLayout, Alignment.TOP_LEFT);

	editParentMerchantContactPersonPanel.setContent(gridParentMerchantContactPersonLayout);
	gridParentMerchantContactPersonLayout.setSizeFull();
	gridParentMerchantContactPersonLayout.setSpacing(true);
	gridParentMerchantContactPersonLayout.setMargin(true);
	gridParentMerchantContactPersonLayout.setColumnExpandRatio(0, 10);
	gridParentMerchantContactPersonLayout.setColumnExpandRatio(1, 20);
	gridParentMerchantContactPersonLayout.setColumnExpandRatio(2, 60);
	gridParentMerchantContactPersonLayout.setColumnExpandRatio(3, 10);
	gridParentMerchantContactPersonLayout.setRowExpandRatio(0, 2);
	gridParentMerchantContactPersonLayout.setRowExpandRatio(1, 1);
	gridParentMerchantContactPersonLayout.setRowExpandRatio(2, 1);
	gridParentMerchantContactPersonLayout.setRowExpandRatio(3, 1);
	gridParentMerchantContactPersonLayout.setRowExpandRatio(4, 2);
	gridParentMerchantContactPersonLayout.addComponent(lblTitle, 1, 0);
	gridParentMerchantContactPersonLayout.setComponentAlignment(lblTitle, Alignment.TOP_LEFT);
	VerticalLayout titleLayout = new VerticalLayout();
	titleLayout.addComponent(cbbTitle);
	titleLayout.addComponent(lblTitleValidateMessage);
	gridParentMerchantContactPersonLayout.addComponent(titleLayout, 2, 0);
	gridParentMerchantContactPersonLayout.setComponentAlignment(titleLayout, Alignment.TOP_LEFT);
	gridParentMerchantContactPersonLayout.addComponent(lblFirstName, 1, 1);
	gridParentMerchantContactPersonLayout.setComponentAlignment(lblFirstName, Alignment.TOP_LEFT);
	VerticalLayout firstNameLayout = new VerticalLayout();
	firstNameLayout.addComponent(txtFirstName);
	firstNameLayout.addComponent(lblFirstNameValidateMessage);
	gridParentMerchantContactPersonLayout.addComponent(firstNameLayout, 2, 1);
	gridParentMerchantContactPersonLayout.setComponentAlignment(firstNameLayout, Alignment.TOP_LEFT);
	gridParentMerchantContactPersonLayout.addComponent(lblLastName, 1, 2);
	gridParentMerchantContactPersonLayout.setComponentAlignment(lblLastName, Alignment.TOP_LEFT);
	VerticalLayout lastNameLayout = new VerticalLayout();
	lastNameLayout.addComponent(txtLastName);
	lastNameLayout.addComponent(lblLastNameValidateMessage);
	gridParentMerchantContactPersonLayout.addComponent(lastNameLayout, 2, 2);
	gridParentMerchantContactPersonLayout.setComponentAlignment(lastNameLayout, Alignment.TOP_LEFT);
	gridParentMerchantContactPersonLayout.addComponent(lblTelephoneNumber, 1, 3);
	gridParentMerchantContactPersonLayout.setComponentAlignment(lblTelephoneNumber, Alignment.TOP_LEFT);
	VerticalLayout telephoneNumberLayout = new VerticalLayout();
	telephoneNumberLayout.addComponent(txtTelephoneNumber);
	telephoneNumberLayout.addComponent(lblTelephoneNumberValidateMessage);
	gridParentMerchantContactPersonLayout.addComponent(telephoneNumberLayout, 2, 3);
	gridParentMerchantContactPersonLayout.setComponentAlignment(telephoneNumberLayout, Alignment.TOP_LEFT);
	gridParentMerchantContactPersonLayout.addComponent(lblEmailAddress, 1, 4);
	gridParentMerchantContactPersonLayout.setComponentAlignment(lblEmailAddress, Alignment.TOP_LEFT);
	VerticalLayout emailAddressLayout = new VerticalLayout();
	emailAddressLayout.addComponent(txtEmailAddress);
	emailAddressLayout.addComponent(lblEmailAddressValidateMessage);
	gridParentMerchantContactPersonLayout.addComponent(emailAddressLayout, 2, 4);
	gridParentMerchantContactPersonLayout.setComponentAlignment(emailAddressLayout, Alignment.TOP_LEFT);

	editMerchantMemberPanel.setContent(gridParentMerchantMemberLayout);
	gridParentMerchantMemberLayout.setSizeFull();
	gridParentMerchantMemberLayout.setSpacing(true);
	gridParentMerchantMemberLayout.setMargin(true);

	gridParentMerchantMemberLayout.addComponent(gridParentMerchantSearchLayout, 0, 0);
	gridParentMerchantMemberLayout.setComponentAlignment(gridParentMerchantSearchLayout, Alignment.TOP_CENTER);
	gridParentMerchantSearchLayout.setSizeFull();
	gridParentMerchantSearchLayout.setSpacing(true);
	gridParentMerchantSearchLayout.setColumnExpandRatio(0, 20);
	gridParentMerchantSearchLayout.setColumnExpandRatio(1, 10);
	gridParentMerchantSearchLayout.setColumnExpandRatio(2, 20);
	gridParentMerchantSearchLayout.setColumnExpandRatio(3, 10);
	gridParentMerchantSearchLayout.setColumnExpandRatio(4, 20);
	gridParentMerchantSearchLayout.setColumnExpandRatio(5, 10);
	gridParentMerchantSearchLayout.setColumnExpandRatio(6, 20);
	gridParentMerchantSearchLayout.setColumnExpandRatio(7, 20);
	gridParentMerchantSearchLayout.addComponent(lblMerchantID, 1, 0);
	gridParentMerchantSearchLayout.setComponentAlignment(lblMerchantID, Alignment.TOP_LEFT);
	gridParentMerchantSearchLayout.addComponent(txtMerchantID, 2, 0);
	gridParentMerchantSearchLayout.setComponentAlignment(txtMerchantID, Alignment.TOP_LEFT);
	gridParentMerchantSearchLayout.addComponent(lblMerchantCompanyName, 3, 0);
	gridParentMerchantSearchLayout.setComponentAlignment(lblMerchantCompanyName, Alignment.TOP_LEFT);
	gridParentMerchantSearchLayout.addComponent(txtMerchantCompanyName, 4, 0);
	gridParentMerchantSearchLayout.setComponentAlignment(txtMerchantCompanyName, Alignment.TOP_LEFT);
	gridParentMerchantSearchLayout.addComponent(lblMerchantUrl, 5, 0);
	gridParentMerchantSearchLayout.setComponentAlignment(lblMerchantUrl, Alignment.TOP_LEFT);
	gridParentMerchantSearchLayout.addComponent(txtMerchantUrl, 6, 0);
	gridParentMerchantSearchLayout.setComponentAlignment(txtMerchantUrl, Alignment.TOP_LEFT);
	gridParentMerchantSearchLayout.addComponent(lblMerchantContactPerson, 1, 1);
	gridParentMerchantSearchLayout.setComponentAlignment(lblMerchantContactPerson, Alignment.TOP_LEFT);
	gridParentMerchantSearchLayout.addComponent(txtMerchantContactPerson, 2, 1);
	gridParentMerchantSearchLayout.setComponentAlignment(txtMerchantContactPerson, Alignment.TOP_LEFT);
	gridParentMerchantSearchLayout.addComponent(lblMerchantStatus, 3, 1);
	gridParentMerchantSearchLayout.setComponentAlignment(lblMerchantStatus, Alignment.TOP_LEFT);
	gridParentMerchantSearchLayout.addComponent(cbbMerchantStatus, 4, 1);
	gridParentMerchantSearchLayout.setComponentAlignment(cbbMerchantStatus, Alignment.TOP_LEFT);
	HorizontalLayout searchCommandLayout = new HorizontalLayout();
	searchCommandLayout.setSizeUndefined();
	searchCommandLayout.setSpacing(true);
	btnMerchantSearch.addStyleName("button-blue");
	btnMerchantClear.addStyleName("button-green");
	btnMerchantSearch.setDisableOnClick(true);
	btnMerchantClear.setDisableOnClick(true);
	btnMerchantSearch.setWidth("70px");
	btnMerchantClear.setWidth("70px");
	searchCommandLayout.addComponent(btnMerchantSearch);
	searchCommandLayout.addComponent(btnMerchantClear);
	gridParentMerchantSearchLayout.addComponent(searchCommandLayout, 0, 2, 7, 2);
	gridParentMerchantSearchLayout.setComponentAlignment(searchCommandLayout, Alignment.MIDDLE_CENTER);

	hCommand.setColumnId("commandLayout");
	hCommand.setType(HorizontalLayout.class);
	hCommand.setAlignment(Align.CENTER);
	hCommand.setDefaultValue(null);
	hCommand.setIconResource(null);
	hCommand.setWidth(80);
	hCommand.setOrder(1);

	hNo.setColumnId("seqNo");
	hNo.setType(Integer.class);
	hNo.setAlignment(Align.CENTER);
	hNo.setDefaultValue(null);
	hNo.setIconResource(null);
	hNo.setWidth(50);
	hNo.setOrder(2);

	hMerchantID.setColumnId("merchantID");
	hMerchantID.setType(String.class);
	hMerchantID.setAlignment(Align.LEFT);
	hMerchantID.setDefaultValue(null);
	hMerchantID.setIconResource(null);
	hMerchantID.setWidth(100);
	hMerchantID.setOrder(3);

	hMerchantCompanyName.setColumnId("merchantCompnayName");
	hMerchantCompanyName.setType(String.class);
	hMerchantCompanyName.setAlignment(Align.LEFT);
	hMerchantCompanyName.setDefaultValue(null);
	hMerchantCompanyName.setIconResource(null);
	hMerchantCompanyName.setWidth(300);
	hMerchantCompanyName.setOrder(4);

	hMerchantUrl.setColumnId("merchantUrl");
	hMerchantUrl.setType(String.class);
	hMerchantUrl.setAlignment(Align.LEFT);
	hMerchantUrl.setDefaultValue(null);
	hMerchantUrl.setIconResource(null);
	hMerchantUrl.setOrder(5);

	hMerchantContactPerson.setColumnId("merchantContactPerson");
	hMerchantContactPerson.setType(String.class);
	hMerchantContactPerson.setAlignment(Align.LEFT);
	hMerchantContactPerson.setDefaultValue(null);
	hMerchantContactPerson.setIconResource(null);
	hMerchantContactPerson.setWidth(200);
	hMerchantContactPerson.setOrder(6);

	hMerchantStatus.setColumnId("merchantStatus");
	hMerchantStatus.setType(String.class);
	hMerchantStatus.setAlignment(Align.CENTER);
	hMerchantStatus.setDefaultValue(null);
	hMerchantStatus.setIconResource(null);
	hMerchantStatus.setWidth(100);
	hMerchantStatus.setOrder(7);

	hId.setColumnId("id");
	hId.setType(Long.class);
	hId.setVisible(false);
	hId.setOrder(8);

	List<TableHeaderProperty> headerProperties = new ArrayList<TableHeaderProperty>();
	headerProperties.add(hCommand);
	headerProperties.add(hNo);
	headerProperties.add(hMerchantID);
	headerProperties.add(hMerchantCompanyName);
	headerProperties.add(hMerchantUrl);
	headerProperties.add(hMerchantContactPerson);
	headerProperties.add(hMerchantStatus);
	headerProperties.add(hId);

	tableMerchantPanel.setTableBeanContainerColumnHeader(headerProperties, SearchMerchantProfileTableItemBean.class);
	tableMerchantPanel.setRowIndexVisiblePageNumber();
	tableMerchantPanel.setTableSelect(false);
	tableMerchantPanel.setAllowSortRecord(false);
	tableMerchantPanel.setEnableTableSorting(false);
	tableMerchantPanel.setTableColumnReordering(false);
	tableMerchantPanel.createControlTablePageNumber();

	gridParentMerchantMemberLayout.addComponent(tableMerchantPanel, 0, 1);
	gridParentMerchantMemberLayout.setComponentAlignment(tableMerchantPanel, Alignment.TOP_CENTER);

	hCommandSelected.setColumnId("commandLayout");
	hCommandSelected.setType(HorizontalLayout.class);
	hCommandSelected.setAlignment(Align.CENTER);
	hCommandSelected.setDefaultValue(null);
	hCommandSelected.setIconResource(null);
	hCommandSelected.setWidth(80);
	hCommandSelected.setOrder(1);

	hNoSelected.setColumnId("seqNo");
	hNoSelected.setType(Integer.class);
	hNoSelected.setAlignment(Align.CENTER);
	hNoSelected.setDefaultValue(null);
	hNoSelected.setIconResource(null);
	hNoSelected.setWidth(50);
	hNoSelected.setOrder(2);

	hMerchantIDSelected.setColumnId("merchantID");
	hMerchantIDSelected.setType(String.class);
	hMerchantIDSelected.setAlignment(Align.LEFT);
	hMerchantIDSelected.setDefaultValue(null);
	hMerchantIDSelected.setIconResource(null);
	hMerchantIDSelected.setWidth(100);
	hMerchantIDSelected.setOrder(3);

	hMerchantCompanyNameSelected.setColumnId("merchantCompnayName");
	hMerchantCompanyNameSelected.setType(String.class);
	hMerchantCompanyNameSelected.setAlignment(Align.LEFT);
	hMerchantCompanyNameSelected.setDefaultValue(null);
	hMerchantCompanyNameSelected.setIconResource(null);
	hMerchantCompanyNameSelected.setWidth(300);
	hMerchantCompanyNameSelected.setOrder(4);

	hMerchantUrlSelected.setColumnId("merchantUrl");
	hMerchantUrlSelected.setType(String.class);
	hMerchantUrlSelected.setAlignment(Align.LEFT);
	hMerchantUrlSelected.setDefaultValue(null);
	hMerchantUrlSelected.setIconResource(null);
	hMerchantUrlSelected.setOrder(5);

	hMerchantContactPersonSelected.setColumnId("merchantContactPerson");
	hMerchantContactPersonSelected.setType(String.class);
	hMerchantContactPersonSelected.setAlignment(Align.LEFT);
	hMerchantContactPersonSelected.setDefaultValue(null);
	hMerchantContactPersonSelected.setIconResource(null);
	hMerchantContactPersonSelected.setWidth(200);
	hMerchantContactPersonSelected.setOrder(6);

	hMerchantStatusSelected.setColumnId("merchantStatus");
	hMerchantStatusSelected.setType(String.class);
	hMerchantStatusSelected.setAlignment(Align.CENTER);
	hMerchantStatusSelected.setDefaultValue(null);
	hMerchantStatusSelected.setIconResource(null);
	hMerchantStatusSelected.setWidth(100);
	hMerchantStatusSelected.setOrder(7);

	hIdSelected.setColumnId("id");
	hIdSelected.setType(Long.class);
	hIdSelected.setVisible(false);
	hIdSelected.setOrder(8);

	List<TableHeaderProperty> headerSelectedProperties = new ArrayList<TableHeaderProperty>();
	headerSelectedProperties.add(hCommandSelected);
	headerSelectedProperties.add(hNoSelected);
	headerSelectedProperties.add(hMerchantIDSelected);
	headerSelectedProperties.add(hMerchantCompanyNameSelected);
	headerSelectedProperties.add(hMerchantUrlSelected);
	headerSelectedProperties.add(hMerchantContactPersonSelected);
	headerSelectedProperties.add(hMerchantStatusSelected);
	headerSelectedProperties.add(hIdSelected);

	tableMerchantSelectedPanel.setTableBeanContainerColumnHeader(headerSelectedProperties, SearchMerchantProfileTableItemBean.class);
	tableMerchantSelectedPanel.setRowIndexVisiblePageNumber();
	tableMerchantSelectedPanel.setTableSelect(false);
	tableMerchantSelectedPanel.setAllowSortRecord(false);
	tableMerchantSelectedPanel.setEnableTableSorting(false);
	tableMerchantSelectedPanel.setTableColumnReordering(false);
	tableMerchantSelectedPanel.createControlTablePageNumber();

	gridParentMerchantMemberLayout.addComponent(tableMerchantSelectedPanel, 0, 2);
	gridParentMerchantMemberLayout.setComponentAlignment(tableMerchantSelectedPanel, Alignment.TOP_CENTER);

	HorizontalLayout commandLayout = new HorizontalLayout();
	commandLayout.setSizeUndefined();
	commandLayout.setSpacing(true);
	commandLayout.setMargin(true);
	btnSave.addStyleName("button-blue");
	btnCancel.addStyleName("button-red");
	btnSave.setDisableOnClick(true);
	btnCancel.setDisableOnClick(true);
	btnSave.setWidth("70px");
	btnCancel.setWidth("70px");
	commandLayout.addComponent(btnSave);
	commandLayout.addComponent(btnCancel);
	gridParentMerchantPanelLayout.addComponent(commandLayout, 0, 2, 3, 2);
	gridParentMerchantPanelLayout.setComponentAlignment(commandLayout, Alignment.MIDDLE_CENTER);

	this.addComponent(this.editParentMerchantPanel);
	this.setComponentAlignment(this.editParentMerchantPanel, Alignment.TOP_CENTER);

	this.txtParentMerchantID.setReadOnly(true);
    }

    @Override
    public void initListener() {
	this.editParentMerchantSaveButtonClickListener.setBasedComponent(this);
	this.editParentMerchantCancelButtonClickListener.setBasedComponent(this);
	this.editParentMerchantSearchMerchantProfileTableAddButtonClickListener.setBasedComponent(this);
	this.editParentMerchantSelectedMerchantProfileTableRemoveButtonClickListener.setBasedComponent(this);
	this.editParentMerchantSearchMerchantProfileSearchButtonClickListener.setBasedComponent(this);
	this.editParentMerchantSearchMerchantProfileClearButtonClickListener.setBasedComponent(this);
	this.editParentMerchantSearchMerchantProfileTablePageButtonClickListener.setBasedComponent(this);
	this.editParentMerchantSearchMerchantProfileTableSizeValueChangeListener.setBasedComponent(this);
	this.editParentMerchantSelectedMerchantProfileTablePageButtonClickListener.setBasedComponent(this);
	this.editParentMerchantSelectedMerchantProfileTableSizeValueChangeListener.setBasedComponent(this);

	this.editParentMerchantSaveButtonClickListener.setAutoEnabled(true);
	this.editParentMerchantCancelButtonClickListener.setAutoEnabled(true);
	this.editParentMerchantSearchMerchantProfileTableAddButtonClickListener.setAutoEnabled(true);
	this.editParentMerchantSelectedMerchantProfileTableRemoveButtonClickListener.setAutoEnabled(true);
	this.editParentMerchantSearchMerchantProfileSearchButtonClickListener.setAutoEnabled(true);
	this.editParentMerchantSearchMerchantProfileClearButtonClickListener.setAutoEnabled(true);

	this.editParentMerchantSearchMerchantProfileTablePageButtonClickListener.setTablePanel(this.tableMerchantPanel);
	this.editParentMerchantSearchMerchantProfileTableSizeValueChangeListener.setTablePanel(this.tableMerchantPanel);
	this.tableMerchantPanel.addPageTableButtonClickListener(this.editParentMerchantSearchMerchantProfileTablePageButtonClickListener);
	this.tableMerchantPanel.addSizeTableValueChangeListener(this.editParentMerchantSearchMerchantProfileTableSizeValueChangeListener);

	this.editParentMerchantSelectedMerchantProfileTablePageButtonClickListener.setTablePanel(this.tableMerchantSelectedPanel);
	this.editParentMerchantSelectedMerchantProfileTableSizeValueChangeListener.setTablePanel(this.tableMerchantSelectedPanel);
	this.tableMerchantSelectedPanel
		.addPageTableButtonClickListener(this.editParentMerchantSelectedMerchantProfileTablePageButtonClickListener);
	this.tableMerchantSelectedPanel
		.addSizeTableValueChangeListener(this.editParentMerchantSelectedMerchantProfileTableSizeValueChangeListener);

	this.btnSave.addClickListener(this.editParentMerchantSaveButtonClickListener);
	this.btnCancel.addClickListener(this.editParentMerchantCancelButtonClickListener);
	this.btnMerchantSearch.addClickListener(this.editParentMerchantSearchMerchantProfileSearchButtonClickListener);
	this.btnMerchantClear.addClickListener(this.editParentMerchantSearchMerchantProfileClearButtonClickListener);

    }

    @Override
    public void initValidator() {

	this.txtParentMerchantName.setMaxLength(100);
	this.txtParentMerchantName.setImmediate(true);
	this.txtParentMerchantName.setRequired(true);
	this.txtParentMerchantName.setRequiredError(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.message.parentName.mandatory"));
	RegexpValidator parentNameRegexpValidator = new RegexpValidator(FormValidatorService.PATTERN_NAME_EN, true,
		this.messageBAO
			.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.message.parentName.format"));
	StringLengthValidator parentNameStringLengthValidator = new StringLengthValidator(
		this.messageBAO
			.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.message.parentName.length"),
		1, 100, false);
	this.txtParentMerchantName.addValidator(parentNameRegexpValidator);
	this.txtParentMerchantName.addValidator(parentNameStringLengthValidator);

	this.txtBusinessAddress.setMaxLength(100);
	this.txtBusinessAddress.setImmediate(true);
	this.txtBusinessAddress.setRequired(true);
	this.txtBusinessAddress.setRequiredError(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.message.businessAddress.mandatory"));
	RegexpValidator businessAddressRegexpValidator = new RegexpValidator(
		FormValidatorService.PATTERN_NAME_EN,
		true,
		this.messageBAO
			.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.message.businessAddress.format"));
	StringLengthValidator businessAddressStringLengthValidator = new StringLengthValidator(
		this.messageBAO
			.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.message.businessAddress.length"),
		1, 100, false);
	this.txtBusinessAddress.addValidator(businessAddressRegexpValidator);
	this.txtBusinessAddress.addValidator(businessAddressStringLengthValidator);

	this.cbbParentStatus.setImmediate(true);
	this.cbbParentStatus.setRequired(true);
	this.cbbParentStatus.setRequiredError(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.message.parentStatus.mandatory"));

	this.cbbTitle.setImmediate(true);
	this.cbbTitle.setRequired(true);
	this.cbbTitle.setRequiredError(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.message.title.mandatory"));

	this.txtFirstName.setMaxLength(100);
	this.txtFirstName.setImmediate(true);
	this.txtFirstName.setRequired(true);
	this.txtFirstName.setRequiredError(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.message.firstName.mandatory"));
	RegexpValidator firstNameRegexpValidator = new RegexpValidator(FormValidatorService.PATTERN_NAME, true,
		this.messageBAO
			.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.message.firstName.format"));
	StringLengthValidator firstNameStringLengthValidator = new StringLengthValidator(
		this.messageBAO
			.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.message.firstName.length"),
		1, 100, false);
	this.txtFirstName.addValidator(firstNameRegexpValidator);
	this.txtFirstName.addValidator(firstNameStringLengthValidator);

	this.txtLastName.setMaxLength(100);
	this.txtLastName.setImmediate(true);
	this.txtLastName.setRequired(true);
	this.txtLastName.setRequiredError(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.message.lastName.mandatory"));
	RegexpValidator lastNameRegexpValidator = new RegexpValidator(FormValidatorService.PATTERN_NAME, true,
		this.messageBAO
			.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.message.lastName.format"));
	StringLengthValidator lastNameStringLengthValidator = new StringLengthValidator(
		this.messageBAO
			.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.message.lastName.length"),
		1, 100, false);
	this.txtLastName.addValidator(lastNameRegexpValidator);
	this.txtLastName.addValidator(lastNameStringLengthValidator);

	this.txtTelephoneNumber.setMaxLength(40);
	this.txtTelephoneNumber.setImmediate(true);
	this.txtTelephoneNumber.setRequired(true);
	this.txtTelephoneNumber.setRequiredError(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.message.telephoneNumber.mandatory"));
	RegexpValidator telephoneNumberRegexpValidator = new RegexpValidator(
		"[0-9-+]*",
		true,
		this.messageBAO
			.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.message.telephoneNumber.format"));
	StringLengthValidator telephoneNumberStringLengthValidator = new StringLengthValidator(
		this.messageBAO
			.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.message.telephoneNumber.length"),
		1, 40, true);
	this.txtTelephoneNumber.addValidator(telephoneNumberRegexpValidator);
	this.txtTelephoneNumber.addValidator(telephoneNumberStringLengthValidator);

	this.txtEmailAddress.setMaxLength(40);
	this.txtEmailAddress.setImmediate(true);
	this.txtEmailAddress.setRequired(true);
	this.txtEmailAddress.setRequiredError(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.message.emailAddress.mandatory"));
	RegexpValidator emailAddressValidator = new RegexpValidator(
		FormValidatorService.PATTERN_EMAIL,
		true,
		this.messageBAO
			.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.message.emailAddress.format"));
	this.txtEmailAddress.addValidator(emailAddressValidator);
	StringLengthValidator emailStringLengthValidator = new StringLengthValidator(
		this.messageBAO
			.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.message.emailAddress.length"),
		1, 40, false);
	this.txtEmailAddress.addValidator(emailStringLengthValidator);

    }

    @SuppressWarnings({ "rawtypes", "unchecked" })
    @Override
    public void initData() {
	try {
	    Long parentMerchantId = (Long) VaadinService.getCurrentRequest().getAttribute(EDIT_PARENT_MERCHANT_ID_REQUEST_ATTRIBUTE);
	    if (parentMerchantId == null) {
		String landing = propertyBAO.getPropertyValue("view.settings-user-control-parentmerchant-search.path");
		this.getUI().getNavigator().navigateTo(landing);
	    } else {
		ParentMerchantBean resultParentMerchantBean = parentMerchantBAO.getParentMerchant(parentMerchantId);
		if (resultParentMerchantBean == null || resultParentMerchantBean.getId() == null) {
		    String msg = this.messageBAO.getMessage("message.error.common");
		    Notification notification = new Notification("Warning", msg, Notification.Type.WARNING_MESSAGE, true);
		    notification.setDelayMsec(1000);
		    notification.show(Page.getCurrent());
		} else {

		    this.setParentMerchantBean(resultParentMerchantBean);

		    String statusDefault = this.propertyBAO
			    .getPropertyValue("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.default.status.item");
		    String statusInclude = this.propertyBAO
			    .getPropertyValue("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.include.status.item");
		    String statusIncludeCaption = this.messageBAO
			    .getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.include.status.item.caption");
		    if (statusInclude != null) {
			String[] statusIncludeArr = statusInclude.split(",");
			String[] statusIncludeCaptionArr = statusIncludeCaption.split(",");
			if (statusIncludeArr != null) {
			    for (int loop = 0; loop < statusIncludeArr.length; loop++) {
				this.cbbMerchantStatus.addItem(statusIncludeArr[loop]);
				this.cbbMerchantStatus.setItemCaption(statusIncludeArr[loop], statusIncludeCaptionArr[loop]);
			    }
			}
		    }

		    List<EntryBean<String, String>> masterData = this.masterDataBAO.selectAllMerchantProfileStatus();
		    if (masterData != null) {
			for (EntryBean<String, String> entry : masterData) {
			    this.merchantStatusMap.put(entry.getKey(), entry.getValue());
			    this.cbbMerchantStatus.addItem(entry.getKey());
			    this.cbbMerchantStatus.setItemCaption(entry.getKey(), entry.getValue());
			}
		    }
		    this.cbbMerchantStatus.select(statusDefault);
		    this.cbbMerchantStatus.setValue(statusDefault);

		    masterData = this.masterDataBAO.selectAllParentMerchantStatus();
		    if (masterData != null) {
			for (EntryBean<String, String> entry : masterData) {
			    this.cbbParentStatus.addItem(entry.getKey());
			    this.cbbParentStatus.setItemCaption(entry.getKey(), entry.getValue());
			}
		    }

		    masterData = this.masterDataBAO.selectAllTitleName();
		    if (masterData != null) {
			for (EntryBean<String, String> entry : masterData) {
			    this.cbbTitle.addItem(entry.getKey());
			    this.cbbTitle.setItemCaption(entry.getKey(), entry.getValue());
			}
		    }

		    uiCommonUtils.setValueUIComponent(this.getTxtParentMerchantID(), resultParentMerchantBean.getParentId());
		    uiCommonUtils.setValueUIComponent(this.getTxtParentMerchantName(), resultParentMerchantBean.getParentName());
		    uiCommonUtils.setValueUIComponent(this.getTxtBusinessAddress(), resultParentMerchantBean.getParentBusniessAddress());
		    uiCommonUtils.setValueUIComponent(this.getCbbParentStatus(), resultParentMerchantBean.getParentStatus());
		    uiCommonUtils.setValueUIComponent(this.getCbbTitle(), resultParentMerchantBean.getContactPersonTitle());
		    uiCommonUtils.setValueUIComponent(this.getTxtFirstName(), resultParentMerchantBean.getContactPersonFirstName());
		    uiCommonUtils.setValueUIComponent(this.getTxtLastName(), resultParentMerchantBean.getContactPersonLastName());
		    uiCommonUtils.setValueUIComponent(this.getTxtTelephoneNumber(),
			    resultParentMerchantBean.getContactPersonTelephoneNumber());
		    uiCommonUtils.setValueUIComponent(this.getTxtEmailAddress(), resultParentMerchantBean.getContactPersonEmailAddress());

		    Set<MerchantProfileBean> merchantProfileBeans = resultParentMerchantBean.getMerchantProfileBeans();
		    this.getSelectedBeanItemMap().clear();
		    List<Long> excludeMerchantIds = new ArrayList<Long>();
		    if (merchantProfileBeans != null && !merchantProfileBeans.isEmpty()) {
			for (MerchantProfileBean merchantProfileBean : merchantProfileBeans) {
			    excludeMerchantIds.add(merchantProfileBean.getId());
			    SearchMerchantProfileTableItemBean searchMerchantProfileTableItemBean = new SearchMerchantProfileTableItemBean();
			    searchMerchantProfileTableItemBean.setId(merchantProfileBean.getId());
			    searchMerchantProfileTableItemBean.setMerchantID(merchantProfileBean.getMerchantId());
			    searchMerchantProfileTableItemBean.setMerchantCompnayName(merchantProfileBean.getCompanyNameEn());
			    searchMerchantProfileTableItemBean.setMerchantUrl(merchantProfileBean.getUrl());
			    searchMerchantProfileTableItemBean.setMerchantContactPerson(merchantProfileBean.getContact1Name());
			    String statusText = this.merchantStatusMap.get(merchantProfileBean.getMerchantStatus());
			    if (statusText == null) {
				statusText = merchantProfileBean.getMerchantStatus();
			    }
			    searchMerchantProfileTableItemBean.setMerchantStatus(statusText);

			    HorizontalLayout hLayout = new HorizontalLayout();
			    Button btnRemove = new Button(
				    this.messageBAO
					    .getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.button.table.remove"));

			    btnRemove.setData(searchMerchantProfileTableItemBean);
			    btnRemove.addClickListener(this.editParentMerchantSelectedMerchantProfileTableRemoveButtonClickListener);
			    btnRemove.setDisableOnClick(true);

			    btnRemove.addStyleName("button-red-small");

			    tableRemoveButtons.add(btnRemove);

			    hLayout.addComponent(btnRemove);

			    searchMerchantProfileTableItemBean.setCommandLayout(hLayout);

			    this.getSelectedBeanItemMap()
				    .put(merchantProfileBean.getId(), new BeanItem(searchMerchantProfileTableItemBean));
			}
		    }

		    Map<Long, BeanItem> selectedBeanItemMap = this.getSelectedBeanItemMap();
		    List<BeanItem> selectedBeanItems = new ArrayList<BeanItem>(selectedBeanItemMap.values());
		    int totalElements = selectedBeanItems.size();
		    Integer itemPerPage = this.getTableMerchantSelectedPanel().getManualPageSize();
		    Integer totalPage = Double.valueOf(Math.ceil(Double.valueOf(totalElements) / Double.valueOf(itemPerPage))).intValue();
		    List<BeanItem> subItems = new ArrayList<BeanItem>();
		    if (totalElements > 1) {
			subItems = selectedBeanItems.subList((totalPage - 1) * itemPerPage, totalElements);
		    } else {
			subItems = selectedBeanItems;
		    }

		    this.getTableMerchantSelectedPanel().clearTableData();
		    this.getTableMerchantSelectedPanel().setManualPageTable(1);
		    this.getTableMerchantSelectedPanel().setTableBeanContainerDataTotalPage(subItems, totalPage,
			    Long.valueOf(totalElements));

		    String sortingDefault = this.propertyBAO
			    .getPropertyValue("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.default.table.sorting");
		    searchCriteriaBean.setDirection1(SearchCriteriaBean.DIRECTION_ASC);
		    searchCriteriaBean.setOrder1(sortingDefault);
		    SearchMerchantProfileBean searchMerchantProfileBean = new SearchMerchantProfileBean();
		    searchMerchantProfileBean.setExcludeMerchantIds(excludeMerchantIds);
		    searchMerchantProfileBean.setSearchAllStatus(Boolean.TRUE);
		    searchCriteriaBean.setCriteriaBean(searchMerchantProfileBean);
		    searchCriteriaBean.setPage(1);
		    searchCriteriaBean.setSize(30);
		    SearchResultBean<MerchantProfileBean> searchResultBean = merchantProfileBAO.selectMerchantProfile(searchCriteriaBean);

		    totalPage = searchResultBean.getTotalPages();
		    if (totalPage == null) {
			totalPage = 1;
		    }
		    Long totalElement = searchResultBean.getTotalElements();
		    if (totalElement == null) {
			totalElement = 0l;
		    }
		    List<BeanItem> beanItems = this.generateTableItemBean(searchResultBean);

		    this.tableMerchantPanel.clearTableData();
		    this.tableMerchantPanel.setManualPageTable(1);
		    this.tableMerchantPanel.setTableBeanContainerDataTotalPage(beanItems, totalPage, totalElement);
		}
	    }
	} catch (Exception e) {
	    e.printStackTrace();
	}
    }

    @SuppressWarnings("rawtypes")
    public List<BeanItem> generateTableItemBean(SearchResultBean<MerchantProfileBean> searchResultBean) {
	List<BeanItem> beanItems = new ArrayList<BeanItem>();
	if (searchResultBean != null && searchResultBean.getContent() != null) {

	    this.tableAddButtons.clear();

	    for (int loop = 0; loop < searchResultBean.getContent().size(); loop++) {
		MerchantProfileBean merchantProfileBean = searchResultBean.getContent().get(loop);
		SearchMerchantProfileTableItemBean searchMerchantProfileTableItemBean = new SearchMerchantProfileTableItemBean();

		searchMerchantProfileTableItemBean.setId(merchantProfileBean.getId());
		searchMerchantProfileTableItemBean.setMerchantID(merchantProfileBean.getMerchantId());
		searchMerchantProfileTableItemBean.setMerchantCompnayName(merchantProfileBean.getCompanyNameEn());
		searchMerchantProfileTableItemBean.setMerchantUrl(merchantProfileBean.getUrl());
		searchMerchantProfileTableItemBean.setMerchantContactPerson(merchantProfileBean.getContact1Name());

		String statusText = this.merchantStatusMap.get(merchantProfileBean.getMerchantStatus());
		if (statusText == null) {
		    statusText = merchantProfileBean.getMerchantStatus();
		}
		searchMerchantProfileTableItemBean.setMerchantStatus(statusText);

		HorizontalLayout hLayout = new HorizontalLayout();
		Button btnAdd = new Button(
			this.messageBAO
				.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.EditParentMerchantView.button.table.add"));

		btnAdd.setData(searchMerchantProfileTableItemBean);
		btnAdd.addClickListener(this.editParentMerchantSearchMerchantProfileTableAddButtonClickListener);
		btnAdd.setDisableOnClick(true);

		btnAdd.addStyleName("button-blue-small");

		tableAddButtons.add(btnAdd);

		hLayout.addComponent(btnAdd);

		searchMerchantProfileTableItemBean.setCommandLayout(hLayout);

		beanItems.add(new BeanItem<SearchMerchantProfileTableItemBean>(searchMerchantProfileTableItemBean));
	    }
	}
	return beanItems;
    }

    public MasterDataBAO getMasterDataBAO() {
	return masterDataBAO;
    }

    public void setMasterDataBAO(MasterDataBAO masterDataBAO) {
	this.masterDataBAO = masterDataBAO;
    }

    public PropertyBAO getPropertyBAO() {
	return propertyBAO;
    }

    public void setPropertyBAO(PropertyBAO propertyBAO) {
	this.propertyBAO = propertyBAO;
    }

    public MessageBAO getMessageBAO() {
	return messageBAO;
    }

    public void setMessageBAO(MessageBAO messageBAO) {
	this.messageBAO = messageBAO;
    }

    public MerchantProfileBAO getMerchantProfileBAO() {
	return merchantProfileBAO;
    }

    public void setMerchantProfileBAO(MerchantProfileBAO merchantProfileBAO) {
	this.merchantProfileBAO = merchantProfileBAO;
    }

    public ParentMerchantBAO getParentMerchantBAO() {
	return parentMerchantBAO;
    }

    public void setParentMerchantBAO(ParentMerchantBAO parentMerchantBAO) {
	this.parentMerchantBAO = parentMerchantBAO;
    }

    public Map<String, String> getMerchantStatusMap() {
	return merchantStatusMap;
    }

    public void setMerchantStatusMap(Map<String, String> merchantStatusMap) {
	this.merchantStatusMap = merchantStatusMap;
    }

    @SuppressWarnings("rawtypes")
    public Map<Long, BeanItem> getSelectedBeanItemMap() {
	return selectedBeanItemMap;
    }

    @SuppressWarnings("rawtypes")
    public void setSelectedBeanItemMap(Map<Long, BeanItem> selectedBeanItemMap) {
	this.selectedBeanItemMap = selectedBeanItemMap;
    }

    public ParentMerchantBean getParentMerchantBean() {
	return parentMerchantBean;
    }

    public void setParentMerchantBean(ParentMerchantBean parentMerchantBean) {
	this.parentMerchantBean = parentMerchantBean;
    }

    public SearchCriteriaBean<SearchMerchantProfileBean> getSearchCriteriaBean() {
	return searchCriteriaBean;
    }

    public void setSearchCriteriaBean(SearchCriteriaBean<SearchMerchantProfileBean> searchCriteriaBean) {
	this.searchCriteriaBean = searchCriteriaBean;
    }

    public EditParentMerchantSearchMerchantProfileSearchButtonClickListener getEditParentMerchantSearchMerchantProfileSearchButtonClickListener() {
	return editParentMerchantSearchMerchantProfileSearchButtonClickListener;
    }

    public void setEditParentMerchantSearchMerchantProfileSearchButtonClickListener(
	    EditParentMerchantSearchMerchantProfileSearchButtonClickListener editParentMerchantSearchMerchantProfileSearchButtonClickListener) {
	this.editParentMerchantSearchMerchantProfileSearchButtonClickListener = editParentMerchantSearchMerchantProfileSearchButtonClickListener;
    }

    public EditParentMerchantSearchMerchantProfileClearButtonClickListener getEditParentMerchantSearchMerchantProfileClearButtonClickListener() {
	return editParentMerchantSearchMerchantProfileClearButtonClickListener;
    }

    public void setEditParentMerchantSearchMerchantProfileClearButtonClickListener(
	    EditParentMerchantSearchMerchantProfileClearButtonClickListener editParentMerchantSearchMerchantProfileClearButtonClickListener) {
	this.editParentMerchantSearchMerchantProfileClearButtonClickListener = editParentMerchantSearchMerchantProfileClearButtonClickListener;
    }

    public EditParentMerchantSearchMerchantProfileTableAddButtonClickListener getEditParentMerchantSearchMerchantProfileTableAddButtonClickListener() {
	return editParentMerchantSearchMerchantProfileTableAddButtonClickListener;
    }

    public void setEditParentMerchantSearchMerchantProfileTableAddButtonClickListener(
	    EditParentMerchantSearchMerchantProfileTableAddButtonClickListener editParentMerchantSearchMerchantProfileTableAddButtonClickListener) {
	this.editParentMerchantSearchMerchantProfileTableAddButtonClickListener = editParentMerchantSearchMerchantProfileTableAddButtonClickListener;
    }

    public EditParentMerchantSelectedMerchantProfileTableRemoveButtonClickListener getEditParentMerchantSelectedMerchantProfileTableRemoveButtonClickListener() {
	return editParentMerchantSelectedMerchantProfileTableRemoveButtonClickListener;
    }

    public void setEditParentMerchantSelectedMerchantProfileTableRemoveButtonClickListener(
	    EditParentMerchantSelectedMerchantProfileTableRemoveButtonClickListener editParentMerchantSelectedMerchantProfileTableRemoveButtonClickListener) {
	this.editParentMerchantSelectedMerchantProfileTableRemoveButtonClickListener = editParentMerchantSelectedMerchantProfileTableRemoveButtonClickListener;
    }

    public EditParentMerchantSearchMerchantProfileTablePageButtonClickListener getEditParentMerchantSearchMerchantProfileTablePageButtonClickListener() {
	return editParentMerchantSearchMerchantProfileTablePageButtonClickListener;
    }

    public void setEditParentMerchantSearchMerchantProfileTablePageButtonClickListener(
	    EditParentMerchantSearchMerchantProfileTablePageButtonClickListener editParentMerchantSearchMerchantProfileTablePageButtonClickListener) {
	this.editParentMerchantSearchMerchantProfileTablePageButtonClickListener = editParentMerchantSearchMerchantProfileTablePageButtonClickListener;
    }

    public EditParentMerchantSearchMerchantProfileTableSizeValueChangeListener getEditParentMerchantSearchMerchantProfileTableSizeValueChangeListener() {
	return editParentMerchantSearchMerchantProfileTableSizeValueChangeListener;
    }

    public void setEditParentMerchantSearchMerchantProfileTableSizeValueChangeListener(
	    EditParentMerchantSearchMerchantProfileTableSizeValueChangeListener editParentMerchantSearchMerchantProfileTableSizeValueChangeListener) {
	this.editParentMerchantSearchMerchantProfileTableSizeValueChangeListener = editParentMerchantSearchMerchantProfileTableSizeValueChangeListener;
    }

    public EditParentMerchantSelectedMerchantProfileTablePageButtonClickListener getEditParentMerchantSelectedMerchantProfileTablePageButtonClickListener() {
	return editParentMerchantSelectedMerchantProfileTablePageButtonClickListener;
    }

    public void setEditParentMerchantSelectedMerchantProfileTablePageButtonClickListener(
	    EditParentMerchantSelectedMerchantProfileTablePageButtonClickListener editParentMerchantSelectedMerchantProfileTablePageButtonClickListener) {
	this.editParentMerchantSelectedMerchantProfileTablePageButtonClickListener = editParentMerchantSelectedMerchantProfileTablePageButtonClickListener;
    }

    public EditParentMerchantSelectedMerchantProfileTableSizeValueChangeListener getEditParentMerchantSelectedMerchantProfileTableSizeValueChangeListener() {
	return editParentMerchantSelectedMerchantProfileTableSizeValueChangeListener;
    }

    public void setEditParentMerchantSelectedMerchantProfileTableSizeValueChangeListener(
	    EditParentMerchantSelectedMerchantProfileTableSizeValueChangeListener editParentMerchantSelectedMerchantProfileTableSizeValueChangeListener) {
	this.editParentMerchantSelectedMerchantProfileTableSizeValueChangeListener = editParentMerchantSelectedMerchantProfileTableSizeValueChangeListener;
    }

    public EditParentMerchantSaveButtonClickListener getEditParentMerchantSaveButtonClickListener() {
	return editParentMerchantSaveButtonClickListener;
    }

    public void setEditParentMerchantSaveButtonClickListener(
	    EditParentMerchantSaveButtonClickListener editParentMerchantSaveButtonClickListener) {
	this.editParentMerchantSaveButtonClickListener = editParentMerchantSaveButtonClickListener;
    }

    public EditParentMerchantCancelButtonClickListener getEditParentMerchantCancelButtonClickListener() {
	return editParentMerchantCancelButtonClickListener;
    }

    public void setEditParentMerchantCancelButtonClickListener(
	    EditParentMerchantCancelButtonClickListener editParentMerchantCancelButtonClickListener) {
	this.editParentMerchantCancelButtonClickListener = editParentMerchantCancelButtonClickListener;
    }

    public Panel getEditParentMerchantPanel() {
	return editParentMerchantPanel;
    }

    public void setEditParentMerchantPanel(Panel editParentMerchantPanel) {
	this.editParentMerchantPanel = editParentMerchantPanel;
    }

    public Panel getEditParentMerchantProfilePanel() {
	return editParentMerchantProfilePanel;
    }

    public void setEditParentMerchantProfilePanel(Panel editParentMerchantProfilePanel) {
	this.editParentMerchantProfilePanel = editParentMerchantProfilePanel;
    }

    public Panel getEditParentMerchantContactPersonPanel() {
	return editParentMerchantContactPersonPanel;
    }

    public void setEditParentMerchantContactPersonPanel(Panel editParentMerchantContactPersonPanel) {
	this.editParentMerchantContactPersonPanel = editParentMerchantContactPersonPanel;
    }

    public Panel getEditMerchantMemberPanel() {
	return editMerchantMemberPanel;
    }

    public void setEditMerchantMemberPanel(Panel editMerchantMemberPanel) {
	this.editMerchantMemberPanel = editMerchantMemberPanel;
    }

    public GridLayout getGridParentMerchantPanelLayout() {
	return gridParentMerchantPanelLayout;
    }

    public void setGridParentMerchantPanelLayout(GridLayout gridParentMerchantPanelLayout) {
	this.gridParentMerchantPanelLayout = gridParentMerchantPanelLayout;
    }

    public GridLayout getGridParentMerchantProfileLayout() {
	return gridParentMerchantProfileLayout;
    }

    public void setGridParentMerchantProfileLayout(GridLayout gridParentMerchantProfileLayout) {
	this.gridParentMerchantProfileLayout = gridParentMerchantProfileLayout;
    }

    public GridLayout getGridParentMerchantContactPersonLayout() {
	return gridParentMerchantContactPersonLayout;
    }

    public void setGridParentMerchantContactPersonLayout(GridLayout gridParentMerchantContactPersonLayout) {
	this.gridParentMerchantContactPersonLayout = gridParentMerchantContactPersonLayout;
    }

    public GridLayout getGridParentMerchantMemberLayout() {
	return gridParentMerchantMemberLayout;
    }

    public void setGridParentMerchantMemberLayout(GridLayout gridParentMerchantMemberLayout) {
	this.gridParentMerchantMemberLayout = gridParentMerchantMemberLayout;
    }

    public GridLayout getGridParentMerchantSearchLayout() {
	return gridParentMerchantSearchLayout;
    }

    public void setGridParentMerchantSearchLayout(GridLayout gridParentMerchantSearchLayout) {
	this.gridParentMerchantSearchLayout = gridParentMerchantSearchLayout;
    }

    public Label getLblParentMerchantID() {
	return lblParentMerchantID;
    }

    public void setLblParentMerchantID(Label lblParentMerchantID) {
	this.lblParentMerchantID = lblParentMerchantID;
    }

    public Label getLblParentMerchantName() {
	return lblParentMerchantName;
    }

    public void setLblParentMerchantName(Label lblParentMerchantName) {
	this.lblParentMerchantName = lblParentMerchantName;
    }

    public Label getLblBusinessAddress() {
	return lblBusinessAddress;
    }

    public void setLblBusinessAddress(Label lblBusinessAddress) {
	this.lblBusinessAddress = lblBusinessAddress;
    }

    public Label getLblParentStatus() {
	return lblParentStatus;
    }

    public void setLblParentStatus(Label lblParentStatus) {
	this.lblParentStatus = lblParentStatus;
    }

    public Label getLblTitle() {
	return lblTitle;
    }

    public void setLblTitle(Label lblTitle) {
	this.lblTitle = lblTitle;
    }

    public Label getLblFirstName() {
	return lblFirstName;
    }

    public void setLblFirstName(Label lblFirstName) {
	this.lblFirstName = lblFirstName;
    }

    public Label getLblLastName() {
	return lblLastName;
    }

    public void setLblLastName(Label lblLastName) {
	this.lblLastName = lblLastName;
    }

    public Label getLblTelephoneNumber() {
	return lblTelephoneNumber;
    }

    public void setLblTelephoneNumber(Label lblTelephoneNumber) {
	this.lblTelephoneNumber = lblTelephoneNumber;
    }

    public Label getLblEmailAddress() {
	return lblEmailAddress;
    }

    public void setLblEmailAddress(Label lblEmailAddress) {
	this.lblEmailAddress = lblEmailAddress;
    }

    public TextField getTxtParentMerchantID() {
	return txtParentMerchantID;
    }

    public void setTxtParentMerchantID(TextField txtParentMerchantID) {
	this.txtParentMerchantID = txtParentMerchantID;
    }

    public TextField getTxtParentMerchantName() {
	return txtParentMerchantName;
    }

    public void setTxtParentMerchantName(TextField txtParentMerchantName) {
	this.txtParentMerchantName = txtParentMerchantName;
    }

    public TextArea getTxtBusinessAddress() {
	return txtBusinessAddress;
    }

    public void setTxtBusinessAddress(TextArea txtBusinessAddress) {
	this.txtBusinessAddress = txtBusinessAddress;
    }

    public ComboBox getCbbParentStatus() {
	return cbbParentStatus;
    }

    public void setCbbParentStatus(ComboBox cbbParentStatus) {
	this.cbbParentStatus = cbbParentStatus;
    }

    public ComboBox getCbbTitle() {
	return cbbTitle;
    }

    public void setCbbTitle(ComboBox cbbTitle) {
	this.cbbTitle = cbbTitle;
    }

    public TextField getTxtFirstName() {
	return txtFirstName;
    }

    public void setTxtFirstName(TextField txtFirstName) {
	this.txtFirstName = txtFirstName;
    }

    public TextField getTxtLastName() {
	return txtLastName;
    }

    public void setTxtLastName(TextField txtLastName) {
	this.txtLastName = txtLastName;
    }

    public TextField getTxtTelephoneNumber() {
	return txtTelephoneNumber;
    }

    public void setTxtTelephoneNumber(TextField txtTelephoneNumber) {
	this.txtTelephoneNumber = txtTelephoneNumber;
    }

    public TextField getTxtEmailAddress() {
	return txtEmailAddress;
    }

    public void setTxtEmailAddress(TextField txtEmailAddress) {
	this.txtEmailAddress = txtEmailAddress;
    }

    public Label getLblParentMerchantIDValidateMessage() {
	return lblParentMerchantIDValidateMessage;
    }

    public void setLblParentMerchantIDValidateMessage(Label lblParentMerchantIDValidateMessage) {
	this.lblParentMerchantIDValidateMessage = lblParentMerchantIDValidateMessage;
    }

    public Label getLblParentMerchantNameValidateMessage() {
	return lblParentMerchantNameValidateMessage;
    }

    public void setLblParentMerchantNameValidateMessage(Label lblParentMerchantNameValidateMessage) {
	this.lblParentMerchantNameValidateMessage = lblParentMerchantNameValidateMessage;
    }

    public Label getLblBusinessAddressValidateMessage() {
	return lblBusinessAddressValidateMessage;
    }

    public void setLblBusinessAddressValidateMessage(Label lblBusinessAddressValidateMessage) {
	this.lblBusinessAddressValidateMessage = lblBusinessAddressValidateMessage;
    }

    public Label getLblParentStatusValidateMessage() {
	return lblParentStatusValidateMessage;
    }

    public void setLblParentStatusValidateMessage(Label lblParentStatusValidateMessage) {
	this.lblParentStatusValidateMessage = lblParentStatusValidateMessage;
    }

    public Label getLblTitleValidateMessage() {
	return lblTitleValidateMessage;
    }

    public void setLblTitleValidateMessage(Label lblTitleValidateMessage) {
	this.lblTitleValidateMessage = lblTitleValidateMessage;
    }

    public Label getLblFirstNameValidateMessage() {
	return lblFirstNameValidateMessage;
    }

    public void setLblFirstNameValidateMessage(Label lblFirstNameValidateMessage) {
	this.lblFirstNameValidateMessage = lblFirstNameValidateMessage;
    }

    public Label getLblLastNameValidateMessage() {
	return lblLastNameValidateMessage;
    }

    public void setLblLastNameValidateMessage(Label lblLastNameValidateMessage) {
	this.lblLastNameValidateMessage = lblLastNameValidateMessage;
    }

    public Label getLblTelephoneNumberValidateMessage() {
	return lblTelephoneNumberValidateMessage;
    }

    public void setLblTelephoneNumberValidateMessage(Label lblTelephoneNumberValidateMessage) {
	this.lblTelephoneNumberValidateMessage = lblTelephoneNumberValidateMessage;
    }

    public Label getLblEmailAddressValidateMessage() {
	return lblEmailAddressValidateMessage;
    }

    public void setLblEmailAddressValidateMessage(Label lblEmailAddressValidateMessage) {
	this.lblEmailAddressValidateMessage = lblEmailAddressValidateMessage;
    }

    public Label getLblMerchantID() {
	return lblMerchantID;
    }

    public void setLblMerchantID(Label lblMerchantID) {
	this.lblMerchantID = lblMerchantID;
    }

    public Label getLblMerchantCompanyName() {
	return lblMerchantCompanyName;
    }

    public void setLblMerchantCompanyName(Label lblMerchantCompanyName) {
	this.lblMerchantCompanyName = lblMerchantCompanyName;
    }

    public Label getLblMerchantUrl() {
	return lblMerchantUrl;
    }

    public void setLblMerchantUrl(Label lblMerchantUrl) {
	this.lblMerchantUrl = lblMerchantUrl;
    }

    public Label getLblMerchantContactPerson() {
	return lblMerchantContactPerson;
    }

    public void setLblMerchantContactPerson(Label lblMerchantContactPerson) {
	this.lblMerchantContactPerson = lblMerchantContactPerson;
    }

    public Label getLblMerchantStatus() {
	return lblMerchantStatus;
    }

    public void setLblMerchantStatus(Label lblMerchantStatus) {
	this.lblMerchantStatus = lblMerchantStatus;
    }

    public TextField getTxtMerchantID() {
	return txtMerchantID;
    }

    public void setTxtMerchantID(TextField txtMerchantID) {
	this.txtMerchantID = txtMerchantID;
    }

    public TextField getTxtMerchantCompanyName() {
	return txtMerchantCompanyName;
    }

    public void setTxtMerchantCompanyName(TextField txtMerchantCompanyName) {
	this.txtMerchantCompanyName = txtMerchantCompanyName;
    }

    public TextField getTxtMerchantUrl() {
	return txtMerchantUrl;
    }

    public void setTxtMerchantUrl(TextField txtMerchantUrl) {
	this.txtMerchantUrl = txtMerchantUrl;
    }

    public TextField getTxtMerchantContactPerson() {
	return txtMerchantContactPerson;
    }

    public void setTxtMerchantContactPerson(TextField txtMerchantContactPerson) {
	this.txtMerchantContactPerson = txtMerchantContactPerson;
    }

    public ComboBox getCbbMerchantStatus() {
	return cbbMerchantStatus;
    }

    public void setCbbMerchantStatus(ComboBox cbbMerchantStatus) {
	this.cbbMerchantStatus = cbbMerchantStatus;
    }

    public Button getBtnMerchantSearch() {
	return btnMerchantSearch;
    }

    public void setBtnMerchantSearch(Button btnMerchantSearch) {
	this.btnMerchantSearch = btnMerchantSearch;
    }

    public Button getBtnMerchantClear() {
	return btnMerchantClear;
    }

    public void setBtnMerchantClear(Button btnMerchantClear) {
	this.btnMerchantClear = btnMerchantClear;
    }

    public TablePanel getTableMerchantPanel() {
	return tableMerchantPanel;
    }

    public void setTableMerchantPanel(TablePanel tableMerchantPanel) {
	this.tableMerchantPanel = tableMerchantPanel;
    }

    public TableHeaderProperty gethCommand() {
	return hCommand;
    }

    public void sethCommand(TableHeaderProperty hCommand) {
	this.hCommand = hCommand;
    }

    public TableHeaderProperty gethNo() {
	return hNo;
    }

    public void sethNo(TableHeaderProperty hNo) {
	this.hNo = hNo;
    }

    public TableHeaderProperty gethMerchantID() {
	return hMerchantID;
    }

    public void sethMerchantID(TableHeaderProperty hMerchantID) {
	this.hMerchantID = hMerchantID;
    }

    public TableHeaderProperty gethMerchantCompanyName() {
	return hMerchantCompanyName;
    }

    public void sethMerchantCompanyName(TableHeaderProperty hMerchantCompanyName) {
	this.hMerchantCompanyName = hMerchantCompanyName;
    }

    public TableHeaderProperty gethMerchantUrl() {
	return hMerchantUrl;
    }

    public void sethMerchantUrl(TableHeaderProperty hMerchantUrl) {
	this.hMerchantUrl = hMerchantUrl;
    }

    public TableHeaderProperty gethMerchantContactPerson() {
	return hMerchantContactPerson;
    }

    public void sethMerchantContactPerson(TableHeaderProperty hMerchantContactPerson) {
	this.hMerchantContactPerson = hMerchantContactPerson;
    }

    public TableHeaderProperty gethMerchantStatus() {
	return hMerchantStatus;
    }

    public void sethMerchantStatus(TableHeaderProperty hMerchantStatus) {
	this.hMerchantStatus = hMerchantStatus;
    }

    public TableHeaderProperty gethId() {
	return hId;
    }

    public void sethId(TableHeaderProperty hId) {
	this.hId = hId;
    }

    public TablePanel getTableMerchantSelectedPanel() {
	return tableMerchantSelectedPanel;
    }

    public void setTableMerchantSelectedPanel(TablePanel tableMerchantSelectedPanel) {
	this.tableMerchantSelectedPanel = tableMerchantSelectedPanel;
    }

    public TableHeaderProperty gethCommandSelected() {
	return hCommandSelected;
    }

    public void sethCommandSelected(TableHeaderProperty hCommandSelected) {
	this.hCommandSelected = hCommandSelected;
    }

    public TableHeaderProperty gethNoSelected() {
	return hNoSelected;
    }

    public void sethNoSelected(TableHeaderProperty hNoSelected) {
	this.hNoSelected = hNoSelected;
    }

    public TableHeaderProperty gethMerchantIDSelected() {
	return hMerchantIDSelected;
    }

    public void sethMerchantIDSelected(TableHeaderProperty hMerchantIDSelected) {
	this.hMerchantIDSelected = hMerchantIDSelected;
    }

    public TableHeaderProperty gethMerchantCompanyNameSelected() {
	return hMerchantCompanyNameSelected;
    }

    public void sethMerchantCompanyNameSelected(TableHeaderProperty hMerchantCompanyNameSelected) {
	this.hMerchantCompanyNameSelected = hMerchantCompanyNameSelected;
    }

    public TableHeaderProperty gethMerchantUrlSelected() {
	return hMerchantUrlSelected;
    }

    public void sethMerchantUrlSelected(TableHeaderProperty hMerchantUrlSelected) {
	this.hMerchantUrlSelected = hMerchantUrlSelected;
    }

    public TableHeaderProperty gethMerchantContactPersonSelected() {
	return hMerchantContactPersonSelected;
    }

    public void sethMerchantContactPersonSelected(TableHeaderProperty hMerchantContactPersonSelected) {
	this.hMerchantContactPersonSelected = hMerchantContactPersonSelected;
    }

    public TableHeaderProperty gethMerchantStatusSelected() {
	return hMerchantStatusSelected;
    }

    public void sethMerchantStatusSelected(TableHeaderProperty hMerchantStatusSelected) {
	this.hMerchantStatusSelected = hMerchantStatusSelected;
    }

    public TableHeaderProperty gethIdSelected() {
	return hIdSelected;
    }

    public void sethIdSelected(TableHeaderProperty hIdSelected) {
	this.hIdSelected = hIdSelected;
    }

    public Button getBtnSave() {
	return btnSave;
    }

    public void setBtnSave(Button btnSave) {
	this.btnSave = btnSave;
    }

    public Button getBtnCancel() {
	return btnCancel;
    }

    public void setBtnCancel(Button btnCancel) {
	this.btnCancel = btnCancel;
    }

    public List<Button> getTableAddButtons() {
	return tableAddButtons;
    }

    public void setTableAddButtons(List<Button> tableAddButtons) {
	this.tableAddButtons = tableAddButtons;
    }

    public List<Button> getTableRemoveButtons() {
	return tableRemoveButtons;
    }

    public void setTableRemoveButtons(List<Button> tableRemoveButtons) {
	this.tableRemoveButtons = tableRemoveButtons;
    }

}
